package com.bosssoft.oss.dao.impl;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.GetObjectRequest;
import com.bosssoft.oss.dao.FileDao;
import com.bosssoft.oss.utils.OssServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.File;
@Repository
public class FileDaoImpl implements FileDao {
    @Autowired
    private OssServer ossServer;
    @Override
    public File getFile(String path) {
        return  new File(path);
    }

    @Override
    public void saveFile(OSSClient ossClient, String bucketName, String path, String fileName) {
        ossServer.OSSClient().getObject(new GetObjectRequest(bucketName,fileName),new File(path+fileName));
    }
}
